package com.android.kmlmrg.utils;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.widget.Toast;

public class AndroidFunctionHelper {
	
	public static void call(Activity vContext, Intent vIntent, String num){
		vIntent = new Intent(Intent.ACTION_CALL);
        vIntent.setData(Uri.parse("tel:" + num));
        vContext.startActivity(vIntent);
        vContext.finish();
	}
	
	public static void sendSMS(Activity vContext, Intent vIntent, String num, String content){
		vIntent = new Intent(Intent.ACTION_VIEW);
		vIntent.setData(Uri.parse("sms:" + num));
		vIntent.putExtra("sms_body", content);
		vContext.startActivity(vIntent);
	}
	
	public static void sendEmail(Activity vContext, Intent vIntent, String recipients,String subject, String content){
		 vIntent = new Intent(android.content.Intent.ACTION_SEND);

		 vIntent.putExtra(android.content.Intent.EXTRA_EMAIL, recipients);

		 vIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);

		 vIntent.putExtra(android.content.Intent.EXTRA_TEXT, content);

		 vIntent.setType("message/rfc822");
		 
		 try {
		 vContext.startActivity(Intent.createChooser(vIntent, "Send  a email"));
		 } catch (android.content.ActivityNotFoundException ex) {
			    Toast.makeText(vContext,"There are no email clients installed.", Toast.LENGTH_SHORT).show();
		 }
	}
}
